from flask_script import Manager, Server
from flask_migrate import Migrate, MigrateCommand
from __init__ import create_app
from config import DevConfig

from models.model import Shulj, db

application = create_app(DevConfig)
migrate = Migrate(application, db)

manager = Manager(application)
manager.add_command("server", Server())
manager.add_command('db', MigrateCommand)


@manager.shell
def make_shell_context():
    return dict(Shulj=Shulj)


if __name__ == "__main__":
    manager.run()
